<?php
	include_once("inc/conn.php");
	include_once("inc/function.php"); 
	include_once("heheadmin/inc/config.php");

	// 今日排行
	$sql = "select a.uid,a.winpoints,b.nickname
		from
		(
			SELECT uid,SUM(points) AS winpoints 
			FROM game_day_static
			WHERE `time` = CURDATE() AND usertype = 0  And points>0
			GROUP BY uid
			ORDER BY winpoints DESC
			LIMIT 30
		) a
		left outer join users b
		on a.uid = b.id
		";
	$query = $db->query($sql);
	$data_today=array();
	while($rs=$db->fetch_array($query)){
		$data_today[]=$rs;
	}
	// 昨天排行
	$sql = "SELECT a.rank_num,a.rank_points,a.prize_points,a.uid,b.nickname
		FROM rank_list a
		LEFT OUTER JOIN users b
		ON a.uid = b.id
		WHERE a.rank_type = 1 AND a.rank_points >1
		ORDER BY rank_num
		limit 30";
	$query = $db->query($sql);
	$data_yesterday=array();
	while($rs=$db->fetch_array($query)){
		$data_yesterday[]=$rs;
	}
 
	// 周排行
	$sql = "SELECT a.rank_num,a.rank_points,a.uid,b.nickname
		FROM rank_list a
		LEFT OUTER JOIN users b
		ON a.uid = b.id
		WHERE a.rank_type = 2 AND a.rank_points >1
		ORDER BY rank_num
		limit 30";
	$query = $db->query($sql);
	$data_Week=array();
	while($rs=$db->fetch_array($query)){
		$data_Week[]=$rs;
	}
 
	
?>
<!Doctype html>
<html lang="zh-cn">
<head>
<?php 
    require 'public/title.inc.php';
    // require 'public/title.inc_yj.php';

?>
<title>保时捷28,蛋蛋28,加拿大28,幸运28,PC蛋蛋,<?=$web_name;?></title>
<link rel="stylesheet" type="text/css" href="style/web.css" />
<link rel="stylesheet" type="text/css" href="style/yj_index.css" />
    <script type="text/javascript" src="js/login.js"></script>
<style type="text/css">
	.list_top{
		height: 43px;
	    line-height: 43px;
	    text-align: center;
	    color: white;
	}
	#Content {
	    width: 1018px;
	    margin: auto;
	    padding-top: 25px;
	    padding-bottom: 30px;
	    overflow: hidden;
	    min-height: 700px;
	    background: #4a4a4a;
	}
	body{color: #FFF;}
</style>
</head>
<body style="background: #2b2b2b;">
<? include_once("top2.php");?> 
<div style="width: 100%;height: 103px;"></div>
<div class="container">
<div class="bcol-fff" style="background: #2b2b2b;">
<div id="Content">
	<div class="rankingsxian"></div>
    <div class="list">    	
            <div class="list_top listtops"><img src="img/i_tit_pic1.jpg"></div>            
            <?php if(empty($data_today)){ ?>  
				<div class="list_top"  >
					没有排行数据              
				</div>
			<?php }else{ /*?>
				<div class="list_top" style="background:#511A7D;">
					<img src="/img/topbg1.jpg"><span>实力之星:<?php echo ChangeEncodeG2U($data_today[0]["nickname"]);?></span>         
				</div>
			<?php 
			*/
				} 
			 ?> 
            <div id="zrbh">	  
			<?php  foreach ($data_today as $num => $data){ 
			$rank_class="rankings".($num+1);
			if($num>2){
				$rank_class="rankings0";
			}
			?>  
            <div class="list_Content">
            	<li class="pm bgs1"><div class="<?php echo $rank_class; ?>"><?php echo ($num+1); ?></div></li>
                <li class="nc bgs1"><?php echo ChangeEncodeG2U($data["nickname"]); ?></li>                     
                <li class="yl bgs1"><?php echo number_format($data["winpoints"]); ?></li> 
            </div>            
            <?php 
				} 
			 ?>        
            
             
            </div>
            <div class="list_Content">
            	
           </div> 
       </div>
             
       <div class="rankingsxian"></div>
       
        <div class="list">
    		 <div class="list_top listtops"><img src="img/i_tit_pic2.jpg"></div>
            <?php if(empty($data_yesterday)){ ?>
				<div class="list_top"  >
					没有排行数据              
				</div>
			<?php }else{
				/*
				?>            
            <div class="list_top" style="background:#2755B3;">
               <img src="/img/topbg2.jpg"><span>尊荣冠军:<?php echo ChangeEncodeG2U($data_yesterday[0]["nickname"]);?></span>
            </div>
			<?php 
			*/
				} 
			 ?>  
			
            <div id="zrbh">
				<?php  foreach ($data_yesterday as $num => $data){
				$rank_class="rankings".($num+1);
				if($num>2){
					$rank_class="rankings0";
				}
				?>  
				 <div class="list_Content">
					<li class="pm "><div class="<?php echo $rank_class; ?>"><?php echo ($num+1); ?></div></li>    
					<li class="nc "><?php echo  ChangeEncodeG2U($data["nickname"]); ?><font color="#FF0000">(奖:<?php echo number_format($data["prize_points"]); ?>)</font></li>               
					<li class="yl "><?php echo number_format($data["rank_points"]); ?></li> 
				</div>
			<?php 
				} 
			?> 				
             
            </div>                        
            <div class="list_Content">
            	
           </div>            
	</div>
    
      <div class="rankingsxian"></div>
       
     <div class="list">
    		 <div class="list_top listtops"><img src="img/i_tit_pic3.jpg"></div>           
			    <?php if(empty($data_Week)){ ?>
					<div class="list_top" >
								  没有排行数据        
					</div>
				<?php }else{
					/*
					?>
				<div class="list_top" style="background:#3A3E47;">
					<img src="/img/topbg3.jpg"><span>荣耀至尊:<?php echo ChangeEncodeG2U($data_Week[0]["nickname"]);?></span>               
				</div>
				<?php
				*/
				} ?> 
            <div id="zrbh">	                    
            	<?php  foreach ($data_Week as $num => $data){
				$rank_class="rankings".($num+1);
				if($num>2){
					$rank_class="rankings0";
				}
				?>   
				<div class="list_Content">
					<li class="pm "><div class="<?php echo $rank_class; ?>"><?php echo ($num+1); ?></div></li>    
					<li class="nc "><?php echo  ChangeEncodeG2U($data["nickname"]); ?></li>                
					 <li class="yl "><?php echo number_format($data["rank_points"]); ?></li> 
				</div>            
				<?php } ?> 		 
				            
             
            </div>                        
            <div class="list_Content">
            	
           </div>  
                    
	</div>
</div>
</div>
</div>
<? include_once("yj_footer.php");?>
</body>
</html>
